import jdebug from "@/_js/debug";

export default {
   createDate(time) {
    
    let isIos = weex.config.env.platform.toUpperCase()!='ANDROID';
    if (isIos) {
      return new Date(time);
    } else {
      const parts = time.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/);
      if (!parts) return null;
      const year = parseInt(parts[1]);
      const month = parseInt(parts[2]) - 1; // 月份是从0开始的
      const day = parseInt(parts[3]);
      const hour = parseInt(parts[4]);
      const minute = parseInt(parts[5]);
      const second = parseInt(parts[6]);
      // 构造兼容的时间戳
      return new Date(year, month, day, hour, minute, second);
    }
   }
}